package org.example.filter;

import com.antgroup.geaflow.model.graph.edge.EdgeDirection;
import com.antgroup.geaflow.model.graph.edge.IEdge;
import com.antgroup.geaflow.state.pushdown.filter.FilterType;
import com.antgroup.geaflow.state.pushdown.filter.IEdgeFilter;

/**
 * other type not support yet
 */
public class Case4EdgeFilter<K, EV> implements IEdgeFilter<K, EV> {

    private static final Case4EdgeFilter<Long, Integer> CASE_4_EDGE_FILTER = new Case4EdgeFilter<>();

    public static Case4EdgeFilter<Long, Integer> instance() {
        return CASE_4_EDGE_FILTER;
    }

    @Override
    public boolean filter(IEdge<K, EV> value) {
        return (value.getDirect() == EdgeDirection.OUT) && ((IEdge<Long, Integer>) value).getValue() == 1;
    }

    @Override
    public FilterType getFilterType() {
        return FilterType.EDGE_LABEL;
    }

    @Override
    public String toString() {
        return getFilterType().name();
    }
}
